#ifndef __SIGEL_MATH_LIB_MAT4_H__
#define __SIGEL_MATH_LIB_MAT4_H__

class quat;

//#define A(i,j) (i*4 + j)

__declspec(align(16)) class mat4
{
#define A(i,j) (i + 4 * j)
public:
	float m[16];

	mat4();
	mat4(float value);
	mat4(const mat4 &copy);

	mat4 operator * (float value);
	vec4 operator * (const vec4 &v);
	vec3 operator * (const vec3 &v);

	mat4 operator * (const mat4 & mat);

	mat4& operator =  ( const mat4& mat);
	mat4& operator =  ( float value);
	mat4& operator += ( const mat4& mat);
	mat4& operator -= ( const mat4& mat);
	mat4& operator *= ( const mat4& mat);
	mat4& operator *= ( float value);
	mat4& operator /= ( float value);

	void MulVec4(vec4 *v);
	void MulMat4(mat4 *v);

	void GetMatrix(float *f);
	void GetTransponseMatrix(float *f);

	void Transponse();

	void identity();
	void rotate(float pitch,float yaw, float roll);
	void scale(float sx, float sy, float sz);
	void scale(float value);
	
	void rotate(quat &rot);
	void rotate(mat3 &rot);

	void translate(float x,float y,float z);
	void translate(vec3 &tr);

	float Get(int i,int j);
	void Set(int i,int j, float val);

};

vec4 operator * (const mat4 &mat, const vec4 &v);
vec3 operator * (const mat4 &mat, const vec3 &v);


#endif
